package utils;

import java.util.*;
import wrappers.CountryWrap;
import wrappers.DepartmentWrap;
import wrappers.EmployeeWrap;

/**
 *
 * @author Alejandro
 */
public class Sorting {
    private final static Map<Integer, SortingStyle> objMap = new TreeMap<Integer, SortingStyle>();

    static {
        objMap.put(EmployeeWrap.IDR, new SortingStyle());
        objMap.put(DepartmentWrap.IDR, new SortingStyle());
        objMap.put(CountryWrap.IDR, new SortingStyle());
    }

    public static void setSortingStyle(int idr, SortingStyle ss) {
        if (objMap.containsKey(idr)) {
            objMap.remove(idr);
            objMap.put(idr, ss);
        }
    }

    public static SortingStyle getSortingStyle(int idr) {
        if (objMap.containsKey(idr))
            return objMap.get(idr);
        else
            return null;
    }

    public static void sort(List<Object> list) {
        Collections.sort(list, new MyComparator());
    }
}
